﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Gecko;

namespace OnlineMusic
{
    public partial class newWindow : Form
    {
        public newWindow()
        {
            InitializeComponent();
        }

        private void webbrowser_DocumentTitleChanged(object sender, EventArgs e)
        {
            this.Text = this.webbrowser.DocumentTitle;
        }

        GeckoWebBrowser webbrowser = null;

        public void ShowWB(GeckoWebBrowser webbrowser)
        {
            this.webbrowser = webbrowser;
            //this.webbrowser.AutoScroll = true;
            this.webbrowser.Dock = System.Windows.Forms.DockStyle.Fill;
            this.webbrowser.Name = "webbrowser";
            this.Controls.Add(webbrowser);
            this.webbrowser.DocumentTitleChanged += new System.EventHandler(webbrowser_DocumentTitleChanged);
            this.webbrowser.Navigating += new System.EventHandler<Gecko.Events.GeckoNavigatingEventArgs>(this.webbrowser_Navigating);
            this.webbrowser.Navigated += new System.EventHandler<Gecko.GeckoNavigatedEventArgs>(this.webbrowser_Navigated);
            this.webbrowser.CreateWindow += new System.EventHandler<Gecko.GeckoCreateWindowEventArgs>(this.webbrowser_CreateWindow);
        }


        private void webbrowser_Navigating(object sender, Gecko.Events.GeckoNavigatingEventArgs e)
        {

        }

        private void webbrowser_Navigated(object sender, Gecko.GeckoNavigatedEventArgs e)
        {
           // if ("".indexof(e.response.contenttype) > -1)
           // {
           // }
        }

        private void webbrowser_CreateWindow(object sender, Gecko.GeckoCreateWindowEventArgs e)
        {
            e.WebBrowser = new GeckoWebBrowser();
            newWindow nw = new newWindow();
            nw.Show();
            nw.ShowWB(e.WebBrowser);
        }
    }
}
